#ifndef SKYROAD_SERVICE_H_
#define SKYROAD_SERVICE_H_

#include <skyroad/message/message.hpp>
#include <skyroad/detail/config.hpp>
#include <skyroad/log/logger.hpp>
#include <skyroad/bus/bus_fwd.hpp>

#include <boost/algorithm/string.hpp>

class SKYROAD_DECL service
{
public:
    service(bus& bus) : m_bus(bus) 
    {

    }

    virtual ~service()
    {

    }

    virtual void start() = 0;

    virtual void stop() = 0;

    virtual void handle_message(message& msg) = 0;

    int id()
    {
        return m_funid; 
    }
    std::string const & name() { return m_svr_name; }
    std::string const & description() { return m_description; }

protected:
	bus& host() { return m_bus; }
	
	void id(int new_id) { m_funid = new_id; }
	virtual void name(const std::string& new_name) { m_svr_name = boost::algorithm::to_lower_copy(new_name); }
	void description(const std::string& new_description) { m_description = new_description; }
public:
	int m_funid;
	std::string m_svr_name;
	std::string m_description;
	bus& m_bus;
};

#endif